<template>
	<view class="zy-row  privacy-view">
		<image :src="checked?$getImageUrl('ic_checked.png'): $getImageUrl('ic_uncheck.png')" style="width: 40rpx;"
			mode="widthFix" @click="changeChecked"></image>
		<text class="privacy-no"> 阅读并同意 </text>
		<text class="privacy" @click="onAgreement">《用户协议》</text>
		<text class="privacy-no"> 和 </text>
		<text class="privacy" @click="onPrivacy">《隐私政策》</text>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from "vue"
	const emit = defineEmits(['change'])

	const checked = ref(false)

	const changeChecked = () => {
		checked.value = !checked.value
		emit('change', checked.value)
	}

	const onAgreement = () => {
		getApp().globalData.webUrl = "https://www.xksndf2002.cn/agreement-momi.html";
		uni.navigateTo({
			url: '/main/web/web'
		})
	}

	const onPrivacy = () => {
		getApp().globalData.webUrl = "https://www.xksndf2002.cn/privacy-momi.html";
		uni.navigateTo({
			url: '/main/web/web'
		})
	}
</script>

<style lang="scss" scoped>
	.privacy-view {
		font-size: $zy-font-sm;

		.privacy {
			color: $zy-color-main;
		}

		.privacy-no {
			color: #fff;
		}
	}
</style>